home *** CD-ROM | disk | FTP | other *** search
- /* Open screen and setup GadTools stuff */
- #include "screen.h"
-
- #include<stdio.h>
-
- #include<clib/intuition_protos.h>
-
- #define MY_TITLE "Hello World Painter"
-
- /* Global record of our screen */
- struct Screen* screen = NULL;
-
- int openScreen(UBYTE depth, UWORD width, UWORD height, ULONG displayid)
- {
- UWORD pens[] = { ~0 };
- /* Try to open a new screen with requested properties */
- /* (A parameter of zero will be ignored, so the default */
- /* value will be used by the screen) */
- if(screen = OpenScreenTags(NULL,
- depth ? SA_Depth : TAG_IGNORE, depth,
- width ? SA_Width : TAG_IGNORE, width,
- height ? SA_Height : TAG_IGNORE, height,
- displayid ? SA_DisplayID : TAG_IGNORE, displayid,
- /* Enable 3D look by specifying SA_Pens */
- SA_Pens, pens,
- SA_Title, MY_TITLE,
- TAG_DONE))
- return TRUE;
- else
- printf("Error: could not create screen\n");
- return FALSE;
- }
-
- void closeScreen()
- {
- if(screen)
- {
- CloseScreen(screen);
- /* Set to NULL to indicate that it's been closed */
- screen = NULL;
- }
- }
-
- struct Screen* getScreen()
- {
- return screen;
- }
-